<%--
  Created by IntelliJ IDEA.
  User: propatalent
  Date: 11/5/11
  Time: 3:33 PM
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" %>
<html>
  <head>
      <title>Simple GSP page</title>
      <meta name="layout" content="main" />
      <style type="text/css">
          .buttonbar > button, .buttonbar > input, .buttonbar > label {
              display: block;
              margin : 15px;
              font-size: smaller;
              z-index: 2000;
              position : relative;
          }
      </style>
  </head>
  <body>

  <div class="buttonbar">
      <button id="paintButton">Paint</button>
      <button id="pathButton">Path</button>
      <button id="exitButton">Exits</button>
      <button id="close">Close</button>
  </div>

  <p:dependantJavascript>
      <script type="text/javascript">
          $(function(){
             $('#paintButton').button({
                 icons: {primary: "ui-icon-pencil"}
             });
             $('#pathButton').button({
                 icons: {primary: "ui-icon-gear"}
             });
             $('#exitButton').button({
                 icons: {primary: "ui-icon-gear"}
             });
             $('#close').button({
                icons: {primary: "ui-icon-arrowreturnthick-1-w"}
                ,text: false
             });
              $('button').click(function(){
                  var btn = $('#close');
                  var id = $(this).attr('id');
                  var closing = id == 'close';

                  if( closing ){
                      id = btn.attr('lastAction');
                      btn.siblings().css('display', 'block');
                  }else{
                      btn.attr('lastAction', id);
                      btn.siblings().css('display', 'none');
                  }
                  var event = {name:'onMenu', bId:id, buttons:closing};
                  inputManager.notifyListeners(event);
              });
          });
      </script>
  </p:dependantJavascript>

  </body>
</html>